# scratch pad

# modules installed in system
##################################################
# does importing modules everywhere use extra memory?
import cv # opencv bindings; installed in package manager
import sys # system specific crap, LIKE sys.argv etc.
import os # system interfaces
import string
import numpy
#import Image
##################################################

##################################################
# modules from this project
from HelperFunctions import *
from WormCountConfigs import *
from ImageJFormat import *
# this depends on Configs
from ChunkImages import *
#this depends on OpenCV and lotsa other crap like that
#from CVGui import *
##################################################

##################################################
if __name__ == '__main__':
  '''this has to go at the end, else the interpreter
  will choke!'''
  #ChunkImages()
  #CVGui('0415')
  #configs = Configs()
  ##############################
  ## and the code begins here.
  ##wind2 = 'the big picture' # neighborhood of worm
  #cv.NamedWindow(wind2,flags=1)
  #framebuffer_big = cv.CreateMat(configs.bigframerows,configs.bigframecols,0) # should be rgb colorspace maybe
  #files = [ f for f in os.listdir(configs.here) if os.path.isfile(f) ] #piss
  #print files
  #platephoto = files[0]
  #thisimage = cv.LoadImageM(configs.here+platephoto,iscolor=2)

  ##cropped = cv.GetSubRect(thisimage, bounding_rect) # tuple: (x,y,dx,dy)
  ##cv.Resize(loadme,framebuffer,interpolation=0)

  #bounding_rect = (800,500,900,900)
  ## oh wait... it's NOT a copy!!! modifying the subrect modifies the original!!!
  ## ALSO, does this mean a subrect can't be ShowImage'd directly?
  #croppedimage = cv.GetSubRect(thisimage, bounding_rect) # tuple: (x,y,dx,dy)
  #cv.Rectangle(croppedimage,(100,100),(200,200),cv.RGB(255,0,0),thickness=3)
  #cv.Resize(croppedimage,framebuffer_big)
  #key = cv.WaitKey(delay=-1)
  #cv.ShowImage(wind2,framebuffer_big)
  ##the corner can only be strictly greater than, so just limit to image width - lesser corner
  while True:
    key = cv.WaitKey(delay=0651)
    print 'piff'
    print str(key)
##################################################
